<?php if (!defined('THINK_PATH')) exit();?> <!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>管理界面</title>

    <!-- Bootstrap -->
    <link href="/IM/Public/css/bootstrap.min.css" rel="stylesheet">

    <script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="/IM/Public/js/bootstrap.min.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

<body>

    <style type="text/css">
	    .table th, .table td {
	        text-align: center;
	    }

	    td.td-left{
	      text-align: left;
	    }

	    li.nav-cell{
	      font-size: 20px;
	      font-weight: 500;
	    }

	    body{
	    	font-size: 24px;
	    }

	    input.login{
	    	border: 1px solid #000;
	    }

    </style>

	<div class="container" >
		<h1>欢迎使用！</h1>
		<br/>
		<table>
			<col width="120px;"></col><col width="280px;"></col>
			<tr>	
				<td>用户名：</td> 
				<td><input id="username" type="text" value="" class="login"/></td>
			</tr>
			<tr style="height:20px;"></tr>
			<tr>	
				<td>密码：</td> 
				<td><input id="password" type="password" value="" class="login" /></td>
			</tr>
			<tr style="height:20px;"></tr>
			<tr><td colspan="2"><button class="btn btn-info btn-lg" style="width:100%" id="login">登陆</button></td>
			</tr>		
		</table>
	</div>

	<div>
		<input type="hidden" value="<?php echo ($baseurl); ?>" id="baseurl">
	</div>

	<script type="text/javascript">
		$("#login").click(function(){
			var baseurl = $("#baseurl").val();
			var username = $("#username").val();
			var password = $("#password").val();
			//alert(baseurl);
			$.ajax({
				type: "POST",
				url: baseurl+"Device/login",
				dataType:"json",
				data:{
					username: username,
					password: password,
				},
				beforeSend: function(){				
				},
				success: function(data){
					if(data["success"]==1){
						//alert("登陆成功！");
						window.location.href=baseurl+"Console/";
					}
					else{
						alert("登陆失败: " + data["error"]);						
					}
				}
			});
		});
	</script>

</body>

</html>